<?php
switch ($_REQUEST['sAction']) {
	case 'appconfig-translate':
		$mResult = AppconfigHandler::translate($_REQUEST['oTranslation']);
		if ($mResult === true) {
			header('Location: index.php?sView='.$_SESSION['sLastBigView']);
			exit();
		}
		break;
	case 'appconfig-upgrade':
		$mResult = AppconfigHandler::upgradeDatabase();
		if ($mResult === true) {
			header('Location: index.php?sView=appconfig-upgrade&bSuccess=1');
			exit();
		}
		break;
	case 'appconfig-setup':
		$mResult = AppconfigHandler::setup(
			$_REQUEST['sRootUser'],
			$_REQUEST['sRootPass'],
			$_REQUEST['sDataHost'],
			$_REQUEST['sDataUser'],
			$_REQUEST['sDataPass'],
			$_REQUEST['sDataPassAgain'],
			$_REQUEST['sDataBase'],
			@$_REQUEST['bUseExisting'],
			$_REQUEST['sUser'],
			$_REQUEST['sPass'],
			$_REQUEST['sPassAgain'],
			$_REQUEST['sFullname'],
			$_REQUEST['sEmail']
		);
		if ($mResult) {
			header('Location: index.php');
			exit();
		}
		break;
	case 'appconfig-set':
		$oAppconfigTypes = AppconfigHandler::getTypes();
		foreach ($oAppconfigTypes as $sVarname => $oThisAppconfigType)
		{
			AppconfigHandler::setConfig($sVarname, $_REQUEST['appconfig_'.$sVarname]);
		}
		header('Location: index.php?sView=appconfig-set&bSuccess=1');
		exit();
		break;
}
?>
